package com.zack.shop.mvp.model;

import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.zack.shop.mvp.contract.LoginContract;
import com.zack.shop.mvp.http.api.service.LoginService;
import com.zack.shop.mvp.http.entity.BaseResponse;

import io.reactivex.Observable;
import okhttp3.RequestBody;


/**
 * @Author 张迁-zhangqian
 * @Data 2018/5/30 下午5:29
 * @Package com.zack.shop.mvp.model
 **/
public class LoginModel extends BaseModel implements LoginContract.Model {
    public LoginModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    public Observable<BaseResponse> loginByUsernamePassword(RequestBody info) {
        return mRepositoryManager.obtainRetrofitService(LoginService.class)
                .loginByUsernamePassword(info);
    }

    @Override
    public Observable<BaseResponse> loginByToken(RequestBody info) {
        return mRepositoryManager.obtainRetrofitService(LoginService.class)
                .loginByToken(info);
    }

    public Observable<BaseResponse> sendSms(RequestBody info) {
        return mRepositoryManager.obtainRetrofitService(LoginService.class)
                .sendSms(info);
    }

    @Override
    public Observable<BaseResponse> updatePwd(RequestBody info) {
        return mRepositoryManager.obtainRetrofitService(LoginService.class)
                .updatePwd(info);
    }

    @Override
    public Observable<BaseResponse> forgetPwd(RequestBody info) {
        return mRepositoryManager.obtainRetrofitService(LoginService.class)
                .forgetPwd(info);
    }

    public Observable<BaseResponse> register(RequestBody info) {
        return mRepositoryManager.obtainRetrofitService(LoginService.class)
                .register(info);
    }


}
